/*
 * Character.cpp
 *
 *  Created on: Oct 8, 2011
 *  Created by: Devin Manno
 *  Updated by: Devin Manno,
 *	Last Update: Oct 14, 2011
 */
#include "Character.h"

Character::Character(string playerName, CharClass cClass) : equipment(EquipmentType::maxSlots) {  //initialize fixed size and NULL values
	setDesc(playerName);

	dead = false;				// character was just created, it's not dead yet!
	characterClass = cClass;
	AttackType attack0("Melee", 100, 0);	// add basic attack for all Characters (swing weapon)
	unlockedAttacks.push_back(true);	// sets attack 0 to true meaning it is unlocked
	attacks.push_back(attack0);		// add basic attack to attacks vector
}

Character::~Character() {
	// TODO Auto-generated destructor stub
}

// getters
/*
 * getNumAttacks
 * Description: gets the number of attacks the character can choose from
 * Pre: none
 * Post: none
 * Returns: the number of attack abilities the character has
 */
int Character::getNumAttacks() const{
	unsigned int count = 0;
	for(unsigned int i = 0; i< unlockedAttacks.size(); i++){
		if(unlockedAttacks[i])
			count++;
	}
	return count;
}

/*
 * isDead
 * Description: checks to see if the player is dead
 * Pre: none
 * Post: none
 * Returns: true if the player is dead, false otherwise
 */
bool Character::isDead() const{
	return dead;
}

/*
 * getEquipment
 * Description: access to the character's equipment slots for GUI and controller classes.
 * Pre: none
 * Post: none
 * Returns: a const ref (read-only) to character's equipment 
 */

const vector<EquipmentType*>& Character::getEquipment() const{
	return equipment;
}

// setters


/*
 * setDead
 * Description: Set's the player's death flag
 * Pre: deadStatus is true if the player is dead, false otherwise
 * Post: Character's dead flag is set to deadStatus
 * Returns: none
 */
void Character::setDead(bool deadStatus){
	dead = deadStatus;
}

/*
 * addAttack
 * Description: Adds an attack to the Characters 
 * Pre: deadStatus is true if the player is dead, false otherwise
 * Post: Character's dead flag is set to deadStatus
 * Returns: none
 */
void Character::addAttack(const AttackType& attack){
	attacks.push_back(attack);	// add new attack to attacks vector
	unlockedAttacks.push_back(true);	// set new attack to unlocked
}

// virtual function implementations
std::string Character::getClassName()const{
	return "Character";
}


